Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / androidApp / src / fdroid / kotlin / org / meshtastic / app / di / FDroidNetworkModule.kt

Displaying Raw • Download

androidApp/src/fdroid/kotlin/org/meshtastic/app/di/FDroidNetworkModule.kt b8ab53e712871d076effd2defc55be720495aba5 (b8ab53e7) Text, 2.03 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.app.di

Tff7b72import T7ee787org.koin.core.annotation.Module
Tff7b72import T7ee787org.koin.core.annotation.Single
Tff7b72import T7ee787org.meshtastic.core.model.NetworkDeviceHardware
Tff7b72import T7ee787org.meshtastic.core.model.NetworkDeviceLinksResponse
Tff7b72import T7ee787org.meshtastic.core.model.NetworkFirmwareReleases
Tff7b72import T7ee787org.meshtastic.core.network.service.ApiService

Tf0883e@Module
Tff7b72class T56d364FDroidNetworkModule Tb4b4b4{

T8b949e/**
* F-Droid builds intentionally avoid network calls to the Meshtastic API.
*
* We throw [UnsupportedOperationException] (an [Exception], not an [Error]) so that `safeCatching {}` in the
* repositories captures the failure and falls back to the bundled JSON assets instead of crashing the app.
*/
Tf0883e@Single
Tff7b72fun Td2a8ffprovideApiServiceTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3ApiService Tff7b72= Tff7b72object Tb4b4b4: T56d364ApiService Tb4b4b4{
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffgetDeviceHardwareTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3ListTff7b72<Te6edf3NetworkDeviceHardwareTff7b72> Tff7b72=
Tff7b72throw Te6edf3UnsupportedOperationExceptionTb4b4b4(Ta5d6ff"Ta5d6ffgetDeviceHardware is not supported on F-Droid builds.Ta5d6ff"Tb4b4b4)

Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffgetDeviceLinksTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3NetworkDeviceLinksResponse Tff7b72=
Tff7b72throw Te6edf3UnsupportedOperationExceptionTb4b4b4(Ta5d6ff"Ta5d6ffgetDeviceLinks is not supported on F-Droid builds.Ta5d6ff"Tb4b4b4)

Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffgetFirmwareReleasesTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3NetworkFirmwareReleases Tff7b72=
Tff7b72throw Te6edf3UnsupportedOperationExceptionTb4b4b4(Ta5d6ff"Ta5d6ffgetFirmwareReleases is not supported on F-Droid builds.Ta5d6ff"Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s